<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>

<style>
    .box {
        width: 400px;
        height: 100px;
        margin: 100px auto;
        background-color: green;
    }

    .box .inner {
        float: right;
        width: 10px;
        height: 20px;
        background-color: yellow;
    }

    .box .inner:hover {
        background-color: red;
        cursor: pointer;
    }
</style>

<body>

<div class="box">
    我是广告
    <div class="inner">X</div>
</div>


<script>
    const element = document.querySelector('.inner');
    element.addEventListener('click', function () {
        const element1 = document.querySelector('.box');
        element1.style.display = 'none'
    })
</script>
</body>
</html>